/// <reference path="../typings/index.d.ts" />
/// <reference path="../src/areaService.ts" />
/// <reference path="../src/tms.ts" />

describe("getAreaList",()=>{
    var injector:ng.auto.IInjectorService;
    var service:IAreaService;

    beforeEach(()=>{
        injector=angular.injector(['ng','tms']);
        service=injector.get<IAreaService>('areaService');
    });

    //获取市
    it('get city by provincecode \'002\' ',(done)=>{
        service.getCity('002').then((res)=>{
            expect(res.data.extData).toBe("002");
            done();
        },(err)=>{
            done.fail(err);
        });
    });

    //获取区
    it('get county by citycode\'003\' ',(done)=>{
        service.getCounty('003').then((res)=>{
            expect(res.data.extData).toBe("003");
            done();
        },(err)=>{
            done.fail(err);
        });
    });

    //获取省
    it('get area by area\'江苏\' ',(done)=>{
        service.getArea().then((res)=>{
            expect(res.data.extData).toBe("江苏");
            done();
        },(err)=>{
            done.fail(err);
        });
    });

});